/**
* Copyright 2009 Waag Society <http://www.waag.org>
* This file is part of Annotrax.
*
* Annotrax is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Annotrax is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Annotrax.
* If not, see http://www.gnu.org/licenses/gpl.html
*/

/**
some specific hidable positioned container areas for Gui elements
*/
self.PlayerOverlay = function(container,contents)
{
	this.el_main = Element("div",{className:"player_overlay"},container)
	
	
	this.el_bottom_area = Element("div",{className:"po_bottom_area"},this.el_main)
	this.el_middle_area = Element("div",{className:"po_middle_area"},this.el_main)
	this.el_top_area = Element("div",{className:"po_top_area"},this.el_main)
	
	 //show the display overlay toggle button on mouse enter
	this.el_toggle = Element("span",{className:"po_toggle"},this.el_main,"hide/show")
	$(this.el_toggle).bind("click", bind(this,"onToggle") );
	$(this.el_main).bind("mouseenter", bind(this,"onMouseEnter") );
	$(this.el_main).bind("mouseleave", bind(this,"onMouseLeave") );		
}
PlayerOverlay.prototype.onMouseEnter = function(evt)
{
	$(this.el_toggle).slideDown();
}
PlayerOverlay.prototype.onMouseLeave = function(evt)
{
	$(this.el_toggle).slideUp();
}
PlayerOverlay.prototype.onToggle = function(evt)
{
	$("div",this.el_main).slideToggle();
}
PlayerOverlay.prototype.getTopArea = function()
{
	return this.el_top_area;
}
PlayerOverlay.prototype.getMiddleArea = function()
{
	return this.el_middle_area;
}
PlayerOverlay.prototype.getBottomArea = function()
{
	return this.el_bottom_area;
}

self.PlayButton = function(container)
{
	this.el_main = Element("div",{className:"play_button"},container)
	$(this.el_main).bind("click",bind(this,"onClick"))
	$(document).bind("player_item_start",bind(this,"onPlay"))
	$(document).bind("player_item_pause",bind(this,"onPause"))
}
PlayButton.prototype.onClick = function()
{
	if($(this.el_main).hasClass("state_play"))
	{
		$(document).trigger(jQuery.Event("pause_button_click"));
	}
	else
	{
		$(document).trigger(jQuery.Event("play_button_click"));
	}
}
/**
On external event from player
*/
PlayButton.prototype.onPlay = function()
{
	$(this.el_main).addClass("state_play")
	$(this.el_main).removeClass("state_pause")
}
/**
On external event from player
*/
PlayButton.prototype.onPause = function()
{
	$(this.el_main).addClass("state_pause")
	$(this.el_main).removeClass("state_play")
}








